package com.prd.service.impl;

import com.prd.enums.BizCodeEnum;
import com.prd.exception.BizException;
import com.prd.feign.SysDeptFeignService;
import com.prd.model.OaDepartmentDO;
import com.prd.mapper.OaDepartmentMapper;
import com.prd.service.OaDepartmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.prd.util.JsonData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 人事管理-部门管理数据表 服务实现类
 * </p>
 *
 * @author lizhaoyi
 * @since 2024-01-28
 */
@Service
@Slf4j
public class OaDepartmentServiceImpl extends ServiceImpl<OaDepartmentMapper, OaDepartmentDO> implements OaDepartmentService {


    @Autowired
    private OaDepartmentMapper oaDepartmentMapper;

    @Autowired
    private SysDeptFeignService deptFeignService;

    /**
     * 申请接收
     * @return
     */
    @Override
    public JsonData getApplyList() {
        return null;
    }

    /**
     * 部门管理列表
     * @return
     */
    @Override
    public JsonData getDeptList() {
        JsonData jsonData = deptFeignService.selectList();
        if (jsonData.getCode() != 0) {
            log.info("获取部门列表失败，msg：{}",jsonData);
            throw new BizException(500,"部门列表获取失败");
        }

        return jsonData;
    }

    /**
     * 根据部门id获取相关岗位列表
     * @param id
     * @return
     */
    @Override
    public JsonData getDeptDetailById(Long id) {

        //查询部门职务列表

        //查询部门岗位列表

        return null;
    }
}
